package com.yidu.manage.controller.base;

import com.yidu.common.utils.ResultUtil;
import com.yidu.manage.domain.SysMenu;
import com.yidu.manage.domain.model.LoginUser;
import com.yidu.manage.service.ITSysMenuService;
import com.yidu.manage.service.system.CurrentUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("system/menu")
public class MenuController
{
    @Autowired
    private ITSysMenuService sysMenuService;

    @GetMapping("list")
    public Object list(SysMenu menu)
    {
        LoginUser user = CurrentUser.getCurrentUser();
        menu.setUserId(user.getId());
        List<SysMenu> menuList = sysMenuService.selectMenuList(menu);
        return ResultUtil.success(menuList);
    }
}
